<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>首页</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />

<!-- easyui -->
<script type="text/javascript" th:src="@{/easyui/jquery.min.js}" ></script>
<script type="text/javascript" th:src="@{/easyui/jquery.easyui.min.js}"></script>
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/default/easyui.css}">
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/icon.css}">
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/color.css}">
	<script type="text/javascript" th:src="@{/easyui/locale/easyui-lang-zh_CN.js}"></script>
</head>
<body>
	<h2>设备入库登记</h2>
	<form id="editForm" method="post">
		设备编号：<input name="did" type="number" class="easyui-validatebox" data-options="required:true"/><br>
		名称：<input name="name" class="easyui-validatebox" data-options="required:true"/><br>
		规格：<input name="util" class="easyui-validatebox"/><br>
		属性:<input name="attribute" class="easyui-validatebox" /><br>
		购入金额:<input name="price" class="easyui-validatebox"/><br>
		购入日期:<input name="buy_date" class="easyui-validatebox"/><br>
		厂家:<input name="factory" class="easyui-validatebox"/><br>
		负责人:<input name="responsible" class="easyui-validatebox"/><br>
		联系电话:<input name="telephone" class="easyui-validatebox"/><br>
		状态:<input name="state" type="radio" class="easyui-validatebox"  value="1" checked="true"/>正常<br>
		使用情况:<input name="used" type="radio" class="easyui-validatebox" value="0" checked="true"/>空闲<br>
		<a id="saveBtn" href="#" class="easyui-linkbutton">保存</a>
	</form>
	<script type="text/javascript" th:inline="none">
	$(function(){
		/*保存*/
		$("#saveBtn").click(function () {
			$("#editForm").form("submit",{
				url:"/device/saveDevice",     //提交表单
				onSubmit:function(){
					return $("#editForm").form("validate");
				},
				success:function(data){   //回传数据
					data=eval("("+data+")")
					if(data.success){
						//$("#win").window("close");
						$.messager.alert("提示","保存成功!","info");
					}else{
						$.messager.alert("提示","保存失败！",data.msg,"error");
					}
				}
			});
		})

	});
	</script>

</body>